fix(html): the envelope states the version the library takes - #877
Merged
Conversation
`odr.editing.getOperations()` and `odr.generateDiff()` stated `"version": 1` while `Document::edit` has taken 2 since #872, so every save the browser produced was refused with "unsupported edit version". Nothing caught it: the check pages read the operations and never the version, and the wasm and gtest suites write their own envelope by hand. So a check on each page that produces one now asserts it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KKFKbUVCYF2VhujdmjhhPW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Generated with Claude Code
The browser-produced save has been broken since #872 merged.
odr.editing.getOperations()— andodr.generateDiff(), which every app andthe wasm package call — stated
"version": 1.Document::edithas taken 2since #872. So every save a reader triggered from a rendered page threw
std::invalid_argument("unsupported edit version")before a single operationwas read.
One line. The rest is the guard.
Why nothing caught it
getOperations()and assert the operations— which ops, in which order, naming which ids — and never the envelope around
them.
wasm/tests/edit.test.mjsanddocument_edit_test.cppboth write their ownenvelope by hand, with
version: 2spelled out.So both sides were tested and the seam between them was not. That is exactly
the JS/C++ drift decision 7 of
editing.mdnames as architecture A's mainrisk.
A check on each page that produces an envelope now asserts the version, which
is the one thing neither side would notice drifting.